var baseURL = 'http://192.168.42.101:88/'
function request(obj){
	if(obj.type==undefined){
		obj.type = 'GET'
	}
	let header= {
		"Accept":"application/json",
		"Content-Type":"application/json;charset=UTF-8"
	}
	let http = {
		url: baseURL + obj.url,
		data: obj.params,
		method: obj.type,
		header: header
	};
	let promise = new Promise((resolve,reject)=>{
		uni.request(http).then(res=>{
			console.log('http',http)
			if(res[1] != undefined){
				resolve(res[1].data)
			}
		}).catch(err=>{
			uni.showToast({
				title:"请求接口失败！",
				icon:"none"
			})
			reject(err);
		})
	});
	return promise
}
export default request